import { S } from '../../s';
import { IPSAppDELogicNodeParam } from '../../app/dataentity/ipsapp-delogic-node-param';
import { IPSDELogic } from './ipsdelogic';
import { IPSDELogicNodeParam } from './ipsdelogic-node-param';
import { IPSDELogicParam } from './ipsdelogic-param';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDELogicNodeParamImpl
  extends PSModelObjectImpl
  implements IPSDELogicNodeParam, IPSAppDELogicNodeParam
{
  get aggMode():
    | 'SUM'
    | 'AVG'
    | 'MAX'
    | 'MIN'
    | 'COUNT'
    | 'GROUP'
    | 'USER'
    | 'USER2'
    | 'USER3'
    | 'USER4' {
    return this.M.aggMode;
  }

  get dstFieldName(): string {
    return this.M.dstFieldName;
  }

  get dstIndex(): number {
    return this.M.dstIndex != null ? this.M.dstIndex : -1;
  }

  protected dstpsdelogicparam: IPSDELogicParam;
  getDstPSDELogicParam(): IPSDELogicParam | null {
    if (this.dstpsdelogicparam != null) return this.dstpsdelogicparam;
    const value = this.M.getDstPSDELogicParam;
    if (value == null) {
      return;
    }
    const ipsdelogic = this.getParentPSModelObject(S._200) as IPSDELogic;
    if (ipsdelogic != null) {
      this.dstpsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.dstpsdelogicparam;
  }

  get dstSortDir(): 'ASC' | 'DESC' {
    return this.M.dstSortDir;
  }

  get expression(): string {
    return this.M.expression;
  }

  get paramAction():
    | 'SETPARAMVALUE'
    | 'RESETPARAM'
    | 'COPYPARAM'
    | 'SQLPARAM'
    | 'SFPLUGINPARAM'
    | 'BINDPARAM'
    | 'APPENDPARAM'
    | 'SORTPARAM'
    | 'RENEWPARAM'
    | 'WEBURIPARAM'
    | 'WEBHEADERPARAM'
    | 'MERGEMAPPARAM'
    | 'AGGREGATEMAPPARAM' {
    return this.M.paramAction;
  }

  get srcFieldName(): string {
    return this.M.srcFieldName;
  }

  get srcIndex(): number {
    return this.M.srcIndex != null ? this.M.srcIndex : -1;
  }

  protected srcpsdelogicparam: IPSDELogicParam;
  getSrcPSDELogicParam(): IPSDELogicParam | null {
    if (this.srcpsdelogicparam != null) return this.srcpsdelogicparam;
    const value = this.M.getSrcPSDELogicParam;
    if (value == null) {
      return;
    }
    const ipsdelogic = this.getParentPSModelObject(S._200) as IPSDELogic;
    if (ipsdelogic != null) {
      this.srcpsdelogicparam = ipsdelogic.findPSDELogicParam(value);
    }
    return this.srcpsdelogicparam;
  }

  get srcSize(): number {
    return this.M.srcSize != null ? this.M.srcSize : -1;
  }

  get srcValue(): string {
    return this.M.srcValue;
  }

  get srcValueStdDataType():
    | 0
    | 1
    | 2
    | 3
    | 4
    | 5
    | 6
    | 7
    | 8
    | 9
    | 10
    | 11
    | 12
    | 13
    | 14
    | 15
    | 16
    | 17
    | 18
    | 19
    | 20
    | 21
    | 22
    | 23
    | 24
    | 25
    | 26
    | 27
    | 28
    | 29 {
    return this.M.srcValueStdDataType != null ? this.M.srcValueStdDataType : 0;
  }

  get srcValueType():
    | 'SRCDLPARAM'
    | 'WEBCONTEXT'
    | 'APPDATA'
    | 'APPLICATION'
    | 'SESSION'
    | 'DATACONTEXT'
    | 'ENVPARAM'
    | 'VIEWPARAM'
    | 'NONEVALUE'
    | 'NULLVALUE'
    | 'SRCVALUE'
    | 'EXPRESSION'
    | 'COUNT'
    | 'AGGREGATION'
    | 'SEQUENCE' {
    return this.M.srcValueType;
  }
  get cls(): string {
    return 'PSDELogicNodeParamImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._1de || cls == S._1df) return true;
    return super.instanceof(cls);
  }
}
